<%@ include file="/common/taglibs.jsp" %>
<script type="text/javascript" src="<c:url value='/js/jquery/jquery.numeric.js'/>"></script>
<script type="text/javascript">
    var impArr = new Array();
    <c:forEach items="${audits.impBeans}" var="impBean" varStatus="status">
      var imp${status.index} = new Object();
      imp${status.index}.id = '${impBean.id}';
      imp${status.index}.action = '${impBean.action}';
      
      <c:if test="${!empty impBean.duedate }">
      <fmt:formatDate value="${impBean.duedate}" pattern="MM/dd/yyyy" var="formattedDuedate"/>
      </c:if>
      imp${status.index}.duedate = '${formattedDuedate}';
    
      <c:if test="${!empty impBean.received }">
      <fmt:formatDate value="${impBean.received}" pattern="MM/dd/yyyy" var="formattedReceived"/>
      </c:if>
      imp${status.index}.received = '${formattedReceived}';
    
      <c:if test="${!empty impBean.performed }">
      <fmt:formatDate value="${impBean.performed}" pattern="MM/dd/yyyy" var="formattedPerformed"/>
      </c:if>
      imp${status.index}.performed = '${formattedPerformed}';
    
      <c:if test="${!empty impBean.closedtofile }">
      <fmt:formatDate value="${impBean.closedtofile}" pattern="MM/dd/yyyy" var="formattedClosedtofile"/>
      </c:if>
      imp${status.index}.closedtofile = '${formattedClosedtofile}';
    
      impArr[${status.index}] = imp${status.index};
    </c:forEach>

    function rePopulateImpTable() {
        $('#impTbody').find('tr').remove();
        var htmlString = '';
        if(impArr.length > 0) {
          for(var i = 0; i < impArr.length; i++) {
          	htmlString += createImpRow(impArr[i], i);
          }
        } else {
       		htmlString += '<tr><td colspan="6">No record found.</td></tr>';
        }
        $('#impTbody').html(htmlString);
        $('#impBeansSize').val(impArr.length);
    }
	/*The impBean property was incorrect. 'duedate'  */
    function createImpRow(imp, index) {
        var htmlString = '';
        htmlString += '<tr class="nodecoration_link">';
        htmlString += '  <td>';
        htmlString += '    <input type="checkbox" value="' + index + '"/>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].id" value="' + imp.id + '"/>';
        htmlString += '  </td>';        
        htmlString += '  <td>';
        htmlString += '    <a href="#" onclick="return false;" class="edit-imp-' + index + '"><div>' + imp.action + '</div></a>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].action" value="' + imp.action + '"/>';
        htmlString += '  </td>';
        htmlString += '  <td>';
       	htmlString += '    <a href="#" onclick="return false;" class="edit-imp-' + index + '"><div>' + imp.duedate + '</div></a>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].duedate" value="' + imp.duedate + '"/>';
        htmlString += '  </td>';
        htmlString += '  <td>';
       	htmlString += '    <a href="#" onclick="return false;" class="edit-imp-' + index + '"><div>' + imp.received + '</div></a>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].received" value="' + imp.received + '"/>';
        htmlString += '  </td>';
        htmlString += '  <td>';
       	htmlString += '    <a href="#" onclick="return false;" class="edit-imp-' + index + '"><div>' + imp.performed + '</div></a>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].performed" value="' + imp.performed + '"/>';
        htmlString += '  </td>';
        htmlString += '  <td>';
       	htmlString += '    <a href="#" onclick="return false;" class="edit-imp-' + index + '"><div>' + imp.closedtofile + '</div></a>';
        htmlString += '    <input type="hidden" name="impBeans[' + index + '].closedtofile" value="' + imp.closedtofile + '"/>';
        htmlString += '  </td>';
        htmlString += '</tr>';
        return htmlString;
    }
    
	function toggleViewEditMode(viewMode) {
		var inputs = $('#auditsForm input[type="text"]:not(.uneditable)');
		var checkboxes = $('#auditsForm input[type="checkbox"]:not(.uneditable)');
		var selects = $('#auditsForm select:not(.uneditable)');
		var textareas = $('#auditsForm textarea:not(.uneditable)');		
		var anchors=$('a[class^="edit-imp-"]') ;
		for(var i = 0; i < anchors.length; i++) {
			anchors[i].disabled = viewMode;			
		}
		for(var i = 0; i < inputs.length; i++) {
			inputs[i].disabled = viewMode;
			if(viewMode) {
				$(inputs[i]).addClass('text_gray');
			} else {
				$(inputs[i]).removeClass('text_gray');
			}
		}
		for(var i = 0; i < checkboxes.length; i++) {
			checkboxes[i].disabled = viewMode;
			if(viewMode) {
				$(checkboxes[i]).addClass('text_gray');
			} else {
				$(checkboxes[i]).removeClass('text_gray');
			}
		}
		for(var i = 0; i < selects.length; i++) {
			selects[i].disabled = viewMode;
			if(viewMode) {
				$(selects[i]).addClass('text_gray');
			} else {
				$(selects[i]).removeClass('text_gray');
			}
		}
		for(var i = 0; i < textareas.length; i++) {
			textareas[i].disabled = viewMode;
			if(viewMode) {
				$(textareas[i]).addClass('text_gray');
			} else {
				$(textareas[i]).removeClass('text_gray');
			}
		}
		
		if(viewMode) {
			$('#cancelEdit').removeClass('blue_btn');
			$('#save').removeClass('blue_btn');
			$('#edit').removeClass('gray_btn');
			
			$('#cancelEdit').addClass('gray_btn');
			$('#save').addClass('gray_btn');
			$('#edit').addClass('blue_btn');
			
			$('#cancelEdit').attr('disabled','disabled');
			$('#save').attr('disabled','disabled');
			$('#edit').removeAttr('disabled');
			
			$('#addImp').attr('disabled','disabled');
			$('#deleteImp').attr('disabled','disabled');
		} else {
			$('#cancelEdit').removeClass('gray_btn');
			$('#save').removeClass('gray_btn');
			$('#edit').removeClass('blue_btn');
			
			$('#cancelEdit').addClass('blue_btn');
			$('#save').addClass('blue_btn');
			$('#edit').addClass('gray_btn');
			
			$('#cancelEdit').removeAttr('disabled');
			$('#save').removeAttr('disabled');
			$('#edit').attr('disabled','disabled');
			
			$('#addImp').removeAttr('disabled');
			$('#deleteImp').removeAttr('disabled');
		}
	}
    
	$(document).ready(function() {
		$('#pageTitle').text('<spring:message code="editAudits.heading" />');
		
		$("#auditsForm").validate({
			rules : {
				auditsName : {
					required : true
				},
				auditsAcronym : {
					required : true
				},
				field : {
					required : true,
					range : [ 0, 100 ]
				}
			}
		});
		
		$("#tabs").tabs();
		
		$('#closeForm').click(function() {
			//if(confirm('Are you sure you want to close the form?')) {
				window.location = '../secure/showDashboard.do';
			//}
	     });

		$('#riskassessment').change(function() {
	 		var elem = document.getElementById("riskassessment");
			var val = parseFloat(elem.value);
			if(val < 0 || val > 100) {
				$('#riskassessmentErr').text('Please enter 0 - 100 only.');
				$('#riskassessment').val('');
			} else {
				$('#riskassessmentErr').text('');
				if (val >= 0 && val <= 20) {
    				elem.style.color = "green";
    				return;
    			}
    			if ((val >= 21 && val <= 40)) {
    				elem.style.color = "blue";
    				return;
    			} else {
    				elem.style.color = "red";
    				return;
    			}
			}
	     });
	     $('#riskassessment').numeric();
	     $('#riskassessment').change();

	     $(".date").datepicker();
	     rePopulateImpTable();	     
	     var edittedImpIndex = -1;	         
	     $('#addImp').click(function() {            	
	         	var htmlString = '';
	         	$('.container').append('<div id="impContainer"></div>');        
		             htmlString +='<br>';       
	             //Form table
		            htmlString +='<div id="impForm"><table style="width: 100%;"><tbody> <tr><td class="label2">IMP Action</td><td><input id="impActionInput" type="text"></td></tr><tr><td class="label2">IMP Due Date</td><td><input id="impDueDate" class="date" type="text"></td></tr><tr><td class="label2">IMP Received</td><td><input id="impReceived" class="date" type="text"></td></tr>';
		 			htmlString +='<tr><td class="label2">IMP Performed</td><td><input id="impPerformed" class="date" type="text"></td></tr>';
		 			htmlString+='<tr><td class="label2">IMP Closed To File</td><td><input id="impClosedToFile" class="date" type="text"></td></tr>';
		 			htmlString +='</tbody></table></div>';	             
	      			var ui = $('#impContainer').append(htmlString);        	           
	            	 $('.date').datepicker({
	                 changeMonth: true,
	                 changeYear: true,
	                 showButtonPanel: true,
	                 dateFormat: 'mm/dd/yy',
	                 onClose: function(dateText, inst) {              
	                     $(this).datepicker('setDate', dateText);
	                 }
	             	});
	             ui.dialog({
	                 title: 'Please Enter an Imp',
	                 autoOpen: false,
	                 width: 310,
	                 modal: true,
	                 resizable: false,
	                 close: function(event, ui) {
	     				$(this).dialog('destroy');
	     				 $('#impContainer').remove();
	     			},
	                 buttons: {
	                     "OK": function() {                    		
	                  		var action= $('#impActionInput').val();
	                  		var d2= $('#impDueDate').val();
	                  		var d3= $('#impReceived').val();
	                  		var d4= $('#impPerformed').val();
	                  		var d5= $('#impClosedToFile').val();
	                    	if(action.trim()=="" || action == null)
	                  		{
	                  			alert("Please Enter an IMP");
	                  		}
	                  		else{
	                  			var imp = null;
	                      		if(edittedImpIndex > -1) {
	                      			// Edit
	              					imp = impArr[edittedImpIndex];
	                      		} else {
	                      			// Add
	                      			imp = new Object();
	                      			imp.id = 0;
	                      			impArr[impArr.length] = imp;
	                      		}
	                  			imp.action = $('#impActionInput').val();
	                      		imp.duedate = $('#impDueDate').val();
	                      		imp.received = $('#impReceived').val();
	                      		imp.performed = $('#impPerformed').val();
	                      		imp.closedtofile = $('#impClosedToFile').val();                     		
	                      		edittedImpIndex = -1;             		
	                      		rePopulateImpTable();
	                            $('#impContainer').remove();
	                  		}	                		
	                     },
	                     "Cancel": function() {
	                         $(this).dialog("close");
	                         $('#impContainer').remove();
	                     }
	                 }
	             });
	             ui.dialog('open');
	         });
		
         $('a[class^="edit-imp-"]').live('click',function(event) {    
 			event.stopPropagation();			
 			$('#impContainer2').remove();
 			var index = parseInt(this.className.substring('edit-imp-'.length));
 			edittedImpIndex = index;					
          	var htmlString = '';
          	$('.container2').append('<div id="impContainer2"></div>');        
 	        htmlString +='<br>';
            //Form table
 	        htmlString +='<div id="impForm2"><table style="width: 100%;"><tbody> <tr><td class="label2">IMP Action</td><td><input id="impActionInput2" type="text"></td></tr><tr><td class="label2">IMP Due Date</td><td><input id="impDueDate2" class="date" type="text"></td></tr><tr><td class="label2">IMP Received</td><td><input id="impReceived2" class="date" type="text"></td></tr>';
 	 		htmlString +='<tr><td class="label2">IMP Performed</td><td><input id="impPerformed2" class="date" type="text"></td></tr>';
 	 		htmlString+='<tr><td class="label2">IMP Closed To File</td><td><input id="impClosedToFile2" class="date" type="text"></td></tr>';
 	 		htmlString +='</tbody></table></div>';	             
       		var ui = $('#impContainer2').append(htmlString);        	           
             $('.date').datepicker({
                  changeMonth: true,
                  changeYear: true,
                  showButtonPanel: true,
                  dateFormat: 'mm/dd/yy',
                  onClose: function(dateText, inst) {              
                      $(this).datepicker('setDate', dateText);
                  }
              });
             $('#impActionInput2').val(impArr[index].action);
         	$('#impDueDate2').val(impArr[index].duedate);
         	$('#impReceived2').val(impArr[index].received);
         	$('#impPerformed2').val(impArr[index].performed);
         	$('#impClosedToFile2').val(impArr[index].closedtofile);
             ui.dialog({
                  title: 'Please Enter an Imp',
                  autoOpen: false,
                  width: 310,
                  modal: true,
                  resizable: false,
                  close: function(event, ui) {
      					$(this).dialog('destroy');
      				 	$('#impContainer2').remove();
      			},
                  buttons: {
                      "OK": function() {                    		
                   		var action= $('#impActionInput2').val();
                   		var d2= $('#impDueDate2').val();
                   		var d3= $('#impReceived2').val();
                   		var d4= $('#impPerformed2').val();
                   		var d5= $('#impClosedToFile2').val();
                     	if(action.trim()=="" || action == null)
                   		{
                   			alert("Enter an Imp Name");
                   		}
                   		else{
                   			var imp = null;
                       		if(edittedImpIndex > -1) {
                       			// Edit
               					imp = impArr[edittedImpIndex];
                       		} else {
                       			// Add
                       			imp = new Object();
                       			imp.id = 0;
                       			impArr[impArr.length] = imp;
                       		}
                       	
                   			imp.action = $('#impActionInput2').val();
                       		imp.duedate = $('#impDueDate2').val();
                       		imp.received = $('#impReceived2').val();
                       		imp.performed = $('#impPerformed2').val();
                       		imp.closedtofile = $('#impClosedToFile2').val();                    
                       		edittedImpIndex = -1;             		
                       		rePopulateImpTable();                       	
 							$('#impContainer2').remove(); 							
                   		}                		
                      },
                      "Cancel": function() {
                          $(this).dialog("close");
                          $('#impContainer2').remove();
                      }
                  }
              });
              ui.dialog('open');
          });
		
		$('#deleteImp').click(function() {
			var changed = false;
			$('#impTbody td > input:checkbox').each(function(index){
				if($(this).prop('checked')) {
					impArr[index] = null;
					changed = true;
				}
			});
			if(changed) {
				impArr = impArr.filter( function(temp){ return temp != null });
				rePopulateImpTable();
			}
		});
		
		$('input[id^="iaclosedtofile"]').change(function() {
			$('input[id^="iaclosedtofile"]').val(this.value);
		});
		
		$('#iaclosedtofile').change();
		
		$('input[id^="faclosedtofile"]').change(function() {
			$('input[id^="faclosedtofile"]').val(this.value);
		});
		
		$('#faclosedtofile').change();
		
		$('textarea[id^="impnotes"]').change(function() {
			$('textarea[id^="impnotes"]').val(this.value);
		});
		
		$('#impnotes').change();
		
		$('textarea[id^="iamemonotes"]').change(function() {
			$('textarea[id^="iamemonotes"]').val(this.value);
		});
		
		$('#iamemonotes').change();
		
		$('textarea[id^="famemonotes"]').change(function() {
			$('textarea[id^="famemonotes"]').val(this.value);
		});
		
		$('#famemonotes').change();
		
		toggleViewEditMode(true);
		
		$('#edit').click(function(){
			toggleViewEditMode(false);
		});
		
		$('#cancelEdit').click(function() {
			var ans = confirm('Are you sure you want to cancel editing this record without saving it?');
			if (ans) {
				loadDiv('content', '${currUrl}');
			}
		});
		
		$('#iarequired').change(function(i, e) {
			updateCheckbox('interimaudit', this.checked);
		});
		
		$('#interimaudit').change(function() {
			updateCheckbox('iarequired', this.checked);
		});
		
		$('#interimaudit').change();
		
		$('#farequired').change(function() {
			updateCheckbox('finalaudit', this.checked);
		});
		
		$('#finalaudit').change(function() {
			updateCheckbox('farequired', this.checked);
		});
		
		$('#finalaudit').change();
	});
	
	function updateCheckbox(id, checked) {
		if(checked) {
			$('#' + id).attr('checked', 'checked');
		} else {
			$('#' + id).removeAttr('checked');
		}
	}
	
	
</script>
<div id="editAuditsDiv">
	<form:form id="auditsForm" cssClass="main_form" name="partnerMonitoringForm" action="auditsForm.do?cipeprojectId=${audits.project.id}" method="post" modelAttribute="audits">
        <form:hidden path="impBeansSize" />
    	<div class="form_head">
    		<a href="#" id="closeForm" class="gray_btn floatR" tabindex="-1">Close Form</a><br class="clear" />
    	</div>
        <div class="form_cont" style="padding-top: 10px;">
			<div style="text-align: center;"><%@ include file="/common/messages.jsp"%></div>
			<div id="auditsTopLeft">
				<div class="row">
					<label class="left">Partner Name:</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="<c:out value="${audits.project.partnerName}"></c:out>" />
				</div>
				<div class="row">
					<label class="left">Donor Name:</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="<c:out value="${audits.project.donorName}"></c:out>" />
				</div>
				<div class="row">
					<label class="left">Project Title:</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="<c:out value="${audits.project.title}"></c:out>" />
				</div>
				<div class="row" style="margin-bottom: 30px">
					<c:if test="${!empty audits.projectStartDate}">
						<fmt:formatDate value="${audits.projectStartDate}" pattern="MM/dd/yyyy" var="formattedStartDate"/>
					</c:if>
				    <c:if test="${!empty audits.projectEndDate}">
						<fmt:formatDate value="${audits.projectEndDate}" pattern="MM/dd/yyyy" var="formattedEndDate"/>
					</c:if>
				    <label class="left">Project Start Date</label>
				    <input type="text" class="text_gray uneditable" style="width: 150px; float: left;" readonly="readonly" value="${formattedStartDate }">
				    <label style="text-align: right; width: 120px; float: left; margin-right: 5px;" >Project End Date</label>
				    <input type="text" class="text_gray uneditable" style="width: 150px; float: left;" readonly="readonly" value="${formattedEndDate }">
				</div>
				<div class="row" style="margin-bottom: 30px">
					<c:if test="${!empty audits.project.startDate}">
						<fmt:formatDate value="${audits.project.startDate}" pattern="MM/dd/yyyy" var="formattedGrantStartDate"/>
					</c:if>
				    <c:if test="${!empty audits.project.endDate}">
						<fmt:formatDate value="${audits.project.endDate}" pattern="MM/dd/yyyy" var="formattedGrantEndDate"/>
					</c:if>
				    <label class="left">Grant Start Date</label>
				    <input type="text" class="text_gray uneditable" style="width: 150px; float: left;" readonly="readonly" value="${formattedGrantStartDate }">
				    <label style="text-align: right; width: 120px; float: left; margin-right: 5px;" >Grant End Date</label>
				    <input type="text" class="text_gray uneditable" style="width: 150px; float: left;" readonly="readonly" value="${formattedGrantEndDate }">
				</div>				
			</div>
			<div id="auditsTopRight">
			    <div class="row">
			        <label class="left">New Grantee?</label>
			        <form:checkbox path="newgrantee" cssClass="right" cssStyle="width: 10px;"/>
			    </div>
			    <div class="row">
			        <label class="left">Donor Award #</label>
			        <input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.donorAwardNumber}">
			    </div>
			    <div class="row">
			        <label class="left">Project #</label>
			        <input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.projectId}">
			    </div>
			</div>
			<br class="clear"/>
			<div id="tabs" style="margin-top: 10px;">
				<ul>
					<li><a href="#generalInformation"><spring:message code="editAudits.heading.generalInformation" /></a></li>
					<li><a href="#internalMonitoring"><spring:message code="editAudits.heading.internalMonitoring" /></a></li>
					<li><a href="#interimAudit"><spring:message code="editAudits.heading.interimAudit" /></a></li>
					<li><a href="#finalAudit"><spring:message code="editAudits.heading.finalAudit" /></a></li>
					<li><a href="#resolution"><spring:message code="editAudits.heading.resolution" /></a></li>
					<li><a href="#auditInfo"><spring:message code="editAudits.heading.auditInformation" /></a></li>
				</ul>
				<div id="generalInformation">
					<div id="genInfoProjectInfo">
						<div class="row">
							<label class="left">Region</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.region}">
						</div>
						<div class="row">
							<label class="left">Country</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.country}">
						</div>
						<div class="row">
							<label class="left">Grant #</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.projectId}">
						</div>
						<div class="row">
							<label class="left">Cipe Funds</label>
							<input type="text" class="right text_gray uneditable" readonly="readonly" value="<fmt:formatNumber type="currency" value="${audits.project.totalFunds}" pattern="$#,##0.##;" />">
						</div>
						<div class="row">
							<label class="left">Status</label><input type="text" class="right text_gray uneditable" readonly="readonly" value="${audits.project.status}">
						</div>
					</div>
					<div class="left">
						Risk Assessment <form:input path="riskassessment"/> <span style="color: green; margin-left: 5px;">Low=0-20</span><span style="color: blue; margin-left: 5px;">Medium=21-40</span><span style="color: red; margin-left: 5px;">High=41-100</span>
                        <div id="riskassessmentErr" style="color: red;">&nbsp;</div>
					</div>
					<div id="genInfoMonitoring">
						<div style="text-decoration: underline; font-weight: bold; margin-bottom: 5px;">Monitoring</div>
						<div class="leftContainer border1px left">
							<div class="row">
								<label class="left">SMP Only?</label>
								<form:checkbox path="smponly" cssClass="right" cssStyle="width: 10px;" />
							</div>
							<div class="row">
								<label class="left">Internal Monitoring?</label>
						        <form:checkbox path="internalmonitoring" cssClass="right" cssStyle="width: 10px;" />							
							</div>
							<div class="row">
								<label class="left">Interim Audit?</label>
						        <form:checkbox id="interimaudit" path="interimaudit" cssClass="right" cssStyle="width: 10px;" />							
							</div>
							<div class="row">
								<label class="left">Final Audit?</label>
						        <form:checkbox id="finalaudit" path="finalaudit" cssClass="right" cssStyle="width: 10px;" />							
							</div>
						</div>
						<div class="rightContainer left">
							<div class="row">
								<label class="left">&nbsp;</label>
						        <label class="right bold_red" >Closed To File?</label>							
							</div>
							<div class="row">
								<label class="left">Date</label>
						        <input class="date" id="iaclosedtofile1" class="right" type="text" />							
							</div>
							<div class="row">
								<label class="left">Date</label>
						        <input class="date" id="faclosedtofile1" class="right" type="text" />
							</div>
							<br class="clear"/>
						</div>
					</div>
					<br class="clear"/>
					<!-- Spacer -->
					<div style="height: 30px;">&nbsp;</div>
				</div>
				<div id="internalMonitoring">
					<span style="margin-left: 25px; margin-right: 5px;">IMP Required?</span><form:checkbox path="imprequired"/>
					<span style="margin-left: 10px; margin-right: 5px;">IMP Notes</span><form:textarea path="impnotes" cssStyle="vertical-align: text-top; width: 300px;" />
					<br class="clear" />
					<table style="width: 100%; background: white; border: 1px solid; margin-top: 15px; margin-bottom: 5px;">
						<thead>
							<tr>
								<th style="width: 1px;"></th>
								<th style="text-align:left;">IMP Action</th>
								<th style="text-align:left;">IMP Due Date</th>
								<th style="text-align:left;">IMP Received</th>
								<th style="text-align:left;">IMP Approved</th>
								<th style="text-align:left;">IMP Closed to File</th>
							</tr>
						</thead>
						<tbody id="impTbody">

						</tbody>
					</table>
					<input type="button" id="addImp" value="Add" style="height: 35px;"/>
                    <input type="button" id="deleteImp" value="Delete" style="height: 35px;"/>
					<br class="clear"/>
				</div>
				<div id="interimAudit">
					<table class="left" style="width: 70%;">
						<tbody>
							<tr>
								<td>
									Interim Audit Required?
                                    <input type="checkbox" id="iarequired">
								</td>
								<td style="text-align: right;">Audit Solicitor</td>
								<td colspan="2">
                                    <form:input path="iasolicitor" cssStyle="width: 100%"/>
								</td>
							</tr>
							<tr>
								<td></td>
								<td class="center_text">Due</td>
								<td class="center_text">Received</td>
								<td class="center_text">Approved</td>
							</tr>
							<tr>
								<td>Auditor Analysis Selection Sheet</td>
								<td><form:input cssClass="date" path="iaselectionmemodue"/></td>
								<td><form:input cssClass="date" path="iaselectionmemoreceived"/></td>
								<td><form:input cssClass="date" path="iaselectionmemoapproved"/></td>
							</tr>
							<tr>
								<td>Interim Audit Firm</td>
								<td colspan="3">
									<form:input path="iafirm" cssStyle="width: 100%;"/>
								</td>
							</tr>
                            <tr>
                              <td>Interim Audit</td>
                              <td><form:input cssClass="date" path="iadue"/></td>
                              <td><form:input cssClass="date" path="iareceived"/></td>
                              <td><form:input cssClass="date" path="iaapproved"/></td>
                            </tr>
							<tr>
								<td>Revised Interim Audit</td>
								<td><form:input cssClass="date" path="iarevisedresolutiondue"/></td>
								<td><form:input cssClass="date" path="iarevisedresolutionreceived"/></td>
								<td><form:input cssClass="date" path="iarevisedresolutionapproved"/></td>
							</tr>
							<tr>
								<td>Resolution of Findings</td>
                                <td><form:input cssClass="date" path="iaresolutionoffindingsdue"/></td>
                                <td><form:input cssClass="date" path="iaresolutionoffindingsreceived"/></td>
                                <td><form:input cssClass="date" path="iaresolutionoffindingsapproved"/></td>
							</tr>
							<tr>
								<td>Revised Resolution of Findings</td>
                                <td><form:input cssClass="date" path="iarevisedresolutionoffindingsdue"/></td>
                                <td><form:input cssClass="date" path="iarevisedresolutionoffindingsreceived"/></td>
                                <td><form:input cssClass="date" path="iarevisedresolutionoffindingsapproved"/></td>								
							</tr>
							<tr>
								<td class="bold_red" colspan="4" style="text-align: center;">Interim audit memo/notes</td>
							</tr>
							<tr>
								<td colspan="4">
									<form:textarea path="iamemonotes" cssStyle="width: 100%"/>
								</td>
							</tr>
						</tbody>
					</table>
					<div class="left" style="text-align: center; width: 200px; position: relative; top: 120px; margin-left: 15px;">
						<div class="bold_red" >Closed to File Date</div>
						<form:input cssClass="date" path="iaclosedtofile" cssStyle="width: 100%"/>
					</div>
					<br class="clear"/>
				</div>
				<div id="finalAudit">
					<table class="left" style="width: 70%;">
						<tbody>
							<tr>
								<td>
									Final Audit Required?
                                    <input type="checkbox" id="farequired">
								</td>
								<td style="text-align: right;">Audit Solicitor</td>
								<td colspan="2">
									<form:input path="fasolicitor" cssStyle="width: 100%" />
								</td>
							</tr>
							<tr>
								<td></td>
								<td class="center_text">Due</td>
								<td class="center_text">Received</td>
								<td class="center_text">Approved</td>
							</tr>
							<tr>
								<td>Auditor Analysis Selection Sheet</td>
								<td><form:input cssClass="date" path="faselectionmemodue"/></td>
								<td><form:input cssClass="date" path="faselectionmemoreceived"/></td>
								<td><form:input cssClass="date" path="faselectionmemoapproved"/></td>
							</tr>
							<tr>
								<td>Final Audit Firm</td>
								<td colspan="3">
									<form:input path="fafirm" cssStyle="width: 100%;" />
								</td>
							</tr>
                            <tr>
                              <td>Final Audit</td>
                              <td><form:input cssClass="date" path="fadue"/></td>
                              <td><form:input cssClass="date" path="fareceived"/></td>
                              <td><form:input cssClass="date" path="faapproved"/></td>
                            </tr>
							<tr>
								<td>Revised Final Audit</td>
								<td><form:input cssClass="date" path="farevisedresolutiondue"/></td>
								<td><form:input cssClass="date" path="farevisedresolutionreceived"/></td>
								<td><form:input cssClass="date" path="farevisedresolutionapproved"/></td>
							</tr>
							<tr>
								<td>Resolution of Findings</td>
								<td><form:input cssClass="date" path="faresolutionoffindingsdue"/></td>
                                <td><form:input cssClass="date" path="faresolutionoffindingsreceived"/></td>
                                <td><form:input cssClass="date" path="faresolutionoffindingsapproved"/></td>
							</tr>
							<tr>
								<td>Revised Resolution of Findings</td>
                                <td><form:input cssClass="date" path="farevisedresolutionoffindingsdue"/></td>
                                <td><form:input cssClass="date" path="farevisedresolutionoffindingsreceived"/></td>
                                <td><form:input cssClass="date" path="farevisedresolutionoffindingsapproved"/></td>
							</tr>
							<tr>
								<td class="bold_red" colspan="4" style="text-align: center;">Final audit memo/notes</td>
							</tr>
							<tr>
								<td colspan="4">
									<form:textarea path="famemonotes" cssStyle="width: 100%"/>
								</td>
							</tr>
						</tbody>
					</table>
					<div class="left" style="text-align: center; width: 200px; position: relative; top: 120px; margin-left: 15px;">
						<div class="bold_red" >Closed to File Date</div>
						<form:input cssClass="date" path="faclosedtofile" cssStyle="width: 100%"/>
					</div>
					<br class="clear"/>
				</div>
				<div id="resolution">
					<div class="center_text">Interim Audit memo/resolution notes</div>
					<div><textarea id="iamemonotes1" rows="" cols="" style="width: 100%"></textarea></div>
					<div class="center_text">Final Audit memo/resolution notes</div>
					<div><textarea id="famemonotes1" rows="" cols="" style="width: 100%"></textarea></div>
					<div>
						Interim Audit Closed to File <input id="iaclosedtofile2" class="date" type="text" style="margin-right: 30px; margin-left: 5px;"/>
						Final Audit Closed to File <input id="faclosedtofile2" class="date" type="text" style=" margin-left: 5px;"/>
					</div>
					<br class="clear"/>
				</div>
				<div id="auditInfo">
					<div><textarea id="impnotes1" rows="" cols="" style="width: 100%"></textarea></div>
					<div><textarea id="iamemonotes2" rows="" cols="" style="width: 100%"></textarea></div>
					<div><textarea id="famemonotes2" rows="" cols="" style="width: 100%"></textarea></div>
					<br class="clear"/>
				</div>
			</div>
			<br />
			<div style="text-align: center;">
              <c:if test="${isGrantUser || isAdminUser}">
                <input type="button" id="edit" class="blue_btn" value="Edit">
              </c:if>
                <input type="button" id="cancelEdit" class="gray_btn" value="Cancel Edit" disabled="disabled">
				<sj:submit id="save" cssClass="gray_btn" target="editAuditsDiv" key="editAudits.button.save" validate="true" attr="disabled='disabled'"/>
			</div>
			<div class="container"></div>
			<div class="container2"></div>
	</form:form>
</div>